//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//********************************************************* 

using System;
using System.Collections.Generic;
using System.IO;

namespace Microsoft.TridentWordAddIn.Common
{
    public interface ITridentServer
    {
        /// <summary>
        /// Gets the trident machines.
        /// </summary>
        /// <returns>List of string</returns>
        List<string> Machines { get; }

        /// <summary>
        /// Gets the jobs.
        /// </summary>
        /// <value>The jobs.</value>
        List<WorkflowJob> Jobs { get; }

        /// <summary>
        /// Gets the workflows.
        /// </summary>
        /// <value>The workflows.</value>
        List<Workflow> Workflows { get; }

        /// <summary>
        /// Gets or sets the current connection.
        /// </summary>
        /// <value>The current connection.</value>
        TridentConnection CurrentTridentConnection { get; set; }

        /// <summary>
        /// Gets the name of the workflow by.
        /// </summary>
        /// <param name="workflowId">The workflow id.</param>
        /// <returns>Workflow</returns>
        Workflow GetWorkflowById(Guid workflowId);

        /// <summary>
        /// Checks the job status.
        /// </summary>
        /// <param name="jobId">The job id.</param>
        /// <returns>WorkflowJobStatus</returns>
        string JobState(Guid jobId, out bool isRunning);

        /// <summary>
        /// Checks the job status.
        /// </summary>
        /// <param name="jobId">The job id.</param>
        /// <returns>WorkflowJobStatus</returns>
        WorkflowJobStatus CheckJobStatus(Guid jobId);
     
        /// <summary>
        /// Gets the job by id.
        /// </summary>
        /// <param name="jobId">The job id.</param>
        /// <returns>WorkflowJob</returns>
        WorkflowJob GetJobById(Guid jobId);
   
        /// <summary>
        /// Runs the workflow.
        /// </summary>
        /// <param name="rerunWorkflowInformation">The rerun workflow information.</param>
        /// <returns>Guid</returns>
        Guid RunWorkflow(RerunWorkflowInformation rerunWorkflowInformation);

        /// <summary>
        /// Exports the package.
        /// </summary>
        /// <param name="guid">The GUID.</param>
        /// <param name="filePath">The file path.</param>
        void ExportPackage(Guid workflowId, string filePath);

        /// <summary>
        /// Downloads the package.
        /// </summary>
        /// <param name="workflowId">The workflow id.</param>
        /// <returns>MemoryStream</returns>
        MemoryStream DownloadPackage(Guid workflowId);

        /// <summary>
        /// Determines whether [is workflow exists] [the specified workflow id].
        /// </summary>
        /// <param name="workflowId">The workflow id.</param>
        /// <returns>
        /// 	<c>true</c> if [is workflow exists] [the specified workflow id]; otherwise, <c>false</c>.
        /// </returns>
        bool IsWorkflowExists(Guid workflowId);

        /// <summary>
        /// Releases unmanaged and - optionally - managed resources
        /// </summary>
        void Dispose();

        /// <summary>
        /// Gets the job ouput.
        /// </summary>
        /// <param name="jobId">The job id.</param>
        /// <returns></returns>
        JobOutputCollection GetJobOutputs(Guid jobId);

        /// <summary>
        /// Gets the job ouput.
        /// </summary>
        /// <param name="outputId">The output id.</param>
        /// <returns></returns>
        JobOutput GetJobOutputById(Guid outputId);

        /// <summary>
        /// Terminates the job.
        /// </summary>
        /// <param name="jobId">The job id.</param>
        void TerminateJob(Guid jobId);

        /// <summary>
        /// Determines whether [is machine online] [the specified machine name].
        /// </summary>
        /// <param name="machineName">Name of the machine.</param>
        /// <returns>
        /// 	<c>true</c> if [is machine online] [the specified machine name]; otherwise, <c>false</c>.
        /// </returns>
        bool IsMachineOnline(string machineName);

        /// <summary>
        /// Determines whether [is machine intractive] [the specified machine name].
        /// </summary>
        /// <param name="machineName">Name of the machine.</param>
        /// <returns>
        /// 	<c>true</c> if [is machine intractive] [the specified machine name]; otherwise, <c>false</c>.
        /// </returns>
        bool IsMachineIntractive(string machineName);

        /// <summary>
        /// Determines whether [is workflow deleted] [the specified workflow id].
        /// </summary>
        /// <param name="workflowId">The workflow id.</param>
        /// <returns>
        /// 	<c>true</c> if [is workflow deleted] [the specified workflow id]; otherwise, <c>false</c>.
        /// </returns>
        bool IsWorkflowDeleted(Guid workflowId);

        /// <summary>
        /// Determines whether [is workflow intractive] [the specified workflow id].
        /// </summary>
        /// <param name="workflowId">The workflow id.</param>
        /// <returns>
        /// 	<c>true</c> if [is workflow intractive] [the specified workflow id]; otherwise, <c>false</c>.
        /// </returns>
        bool IsWorkflowIntractive(Guid workflowId);

    }
}
